<!--#include virtual="/Common/Config.asp" -->
<!--#include virtual="/Common/conn.asp" -->
<!--#include virtual="/Common/Function.asp" -->
<%
'****************************************************
' 检查用户是否存在
'****************************************************

Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"

Response.ContentType="text/html" 
'Response.CharSet="UTF-8"

Dim UserName,BadWord,SystemWord

BadWord = ",|--|fuck|and|admin"
SystemWord = "共产党|胡锦涛|江泽民|法轮功|李洪志|洪志|管理员|系统管理员"
UserName   = request("UserName")

Response.Write Check_User(UserName)

Function Check_User(UserName)

	Err.Clear
	On Error Resume Next

	BadWord_Flag= False

	If Check_BadWord(UserName,SystemWord) Then '系统屏蔽字符

		Check_User = "3"
		Exit Function

	End If

	If Check_BadWord(UserName,BadWord) Then '系统保留字符

		Check_User = "4"
		Exit Function

	End If

	patrn = "[\u4e00-\u9fa5A-Za-z0-9-_]+$" '中文 a-z0-9 _-字符
		
	If RegExpTest(patrn,UserName)=False Then
		Check_User = "5"
		Exit Function
		
	End If


	sql = "SELECT * FROM Member WHERE UserName ='" & UserName & "'"
	'writebr sql
	Set rs = conn.execute(sql)

	If rs.eof Then
		Check_User = "1"
	Else
		Check_User = "2"
	End If
	
    rs.close

	If Err.Number>0 Then
		Check_User = "9"
	End If

End Function 

Function Check_BadWord(Check_value,Bad_Str)

	BadWord_Flag= False
	
	Str_Arr = Split(Bad_Str,"|")

	For i = 0 To UBound(Str_Arr)
		If InStr(Check_value,Str_Arr(i))>0 Then
			BadWord_Flag = True
			Exit For
		End If
	Next

	If BadWord_Flag = True Then
		Check_BadWord = True
	Else
		Check_BadWord = False
	End If

End Function



%>